<template>
  <nav class="topnav">
    <div class="container">
      <ul>
        <li><a href="javascript:;"><i class="iconfont icon-user"></i>pigStar</a></li>
        <li><a href="javascript:;">退出登录</a></li>
        <li v-if="show"><RouterLink to="/login">请先登录</RouterLink></li>
        <li><a href="javascript:;">免费注册</a></li>
        <li><a href="javascript:;">我的订单</a></li>
        <li><a href="javascript:;">会员中心</a></li>
        <li><a href="javascript:;">帮助中心</a></li>
        <li><a href="javascript:;">关于我们</a></li>
      </ul>
    </div>
  </nav>
</template>

<script>
import { ref } from 'vue';
export default {
  name:'TopNav',
  setup(){
    const show = ref(true);
    const account = () =>{
      if(localStorage.getItem('token')){
        console.log(show.value);
        show.value = false;
      }
    };
      return {show,account}
  }
}
</script>

<style lang="less" scoped>
.topnav{
  background-color: #333;
  ul{
    display: flex;
    height: 53px;
    justify-content: flex-end;
    align-items: center;
    li{
      a{
        padding: 0 15px;
        color:#cdcdcd;
        line-height: 1;
        display: inline-block;
        i{
          font-size: 14px;
          margin-right: 2px;
        }
        &:hover{
          color:@shopColor;
        }
      }
      ~li{
        a{
          border-left: 2px solid #666;
        }
      }
    }
  }
}
</style>
